package com.gton.lpl.controller;


import com.gton.lpl.common.pojo.Resp;
import com.gton.lpl.entity.dto.PageRespDto;
import com.gton.lpl.entity.dto.TTransferManageDTO;
import com.gton.lpl.service.TTransferManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 副表 前端控制器
 * </p>
 *
 * @author GuoTong
 * @since 2022-08-04
 */
@RestController
@RequestMapping("/t-transfer-manage")
@Api(tags = {"ceshi"})
@Slf4j
public class TTransferManageController {


    @Resource
    private TTransferManageService tTransferManageService;

    @PostMapping("/123")
    @ApiOperation(value = "测试", notes = "测试")
    public Resp selectByWhere(@RequestBody TTransferManageDTO tTransferManageDTO) {
        String currentCode = tTransferManageDTO.getCurrentCode();
        String userName = tTransferManageDTO.getUserName();
        Resp<PageRespDto> resp = Resp.Ok(null);
        //全量查询
        if (StringUtils.isAllEmpty(currentCode,userName)) {
            throw new RuntimeException("currentCode  and  userName  is  all  null");
        }
        // 全量查询
        PageRespDto list = tTransferManageService.selectByWhereParam(tTransferManageDTO);
        resp.setData(list);
        return resp;
    }

}

